def solve(nums):
    from functools import reduce
    k=bin(reduce(lambda x,y:x^y,nums))
    i,n=1,len(str(k))
    while(str(k)[n-i]!='1'):
        i+=1
    lst1,lst2=[],[]
    for num in nums:
        n=len(str(bin(num)))
        if n-i>=0 and str(bin(num))[n-i]=='1': lst1.append(num)
        else: lst2.append(num)
    k1=reduce(lambda x,y:x^y,lst1)
    k2=reduce(lambda x,y:x^y,lst2)
    return [k1,k2]
    
print(solve([2,4,3,6,3,2,5,5]))